module $Xrm {
    export class Entity {
        public Id: string;
        public LogicalName: string;

        constructor(logicalName?: string, id?: string) {
            this.LogicalName = logicalName;
            this.Id = id;
        }

        GetAttributeValue(attributeLogicalName: string): any {
            if (this[attributeLogicalName] != null) {
                return this[attributeLogicalName];
            }
            return null;
        }
    }

    export class EntityReference {
        public LogicalName: string;
        public Id: string;
        public Name: string;

        constructor(logicalName?: string, id?: string) {
            this.LogicalName = logicalName;
            this.Id = id;
        }
    }

    export class Money {
        public Value: number;

        constructor(value?: number) {
            this.Value = value;
        }
    }

    export class OptionSetValue {
        public Value: number;

        constructor(value?: number) {
            this.Value = value;
        }
    }

    export class FetchExpression {
        public Query: string;

        constructor(query?: string) {
            this.Query = query;
        }
    }

    export class EntityMetadata {
        constructor() {
        }

        get (index: string) {
            if (this[index] != null) {
                return this[index];
            }
            return null;
        }
    }
}